package com.prs.crm.dao.cqunicom.impl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateCallback;

import com.prs.crm.dao.cqunicom.NoteContentDao;
import com.prs.crm.dao.impl.BaseDaoImpl;
import com.prs.crm.domain.cqunicom.NoteContent;

/**
 * @author LanXiaoGang
 * @E-mail:lan9liang@163.com
 * @qq:7857553326
 * @version 创建时间：2011-3-17 下午05:03:06
 * 简单说明
 */

public class NoteContentDaoImpl extends BaseDaoImpl<NoteContent> implements
		NoteContentDao {

	@Override
	public List<NoteContent> getAllNoteContent() {
		 return (List<NoteContent>) this.getHibernateTemplate().execute(
					new HibernateCallback()
					{
						public Object doInHibernate(Session session) throws HibernateException {
				        	Criteria criteria = session.createCriteria(NoteContent.class);			        	
							return criteria.list();
				 				        	
				        }
					}
			);
	}

	@Override
	public Integer delNoteContent() {
		return (Integer) this.getHibernateTemplate().execute(
			      new HibernateCallback() {   
						public Object doInHibernate(Session session) throws HibernateException {
							Query query = session.createQuery("delete from NoteContent");
							return query.executeUpdate();
				        }   
				 } );
	}

}
